package com.northone.statistics.adapter;

import com.northone.statistics.R;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class LeftMonthAdapter extends BaseAdapter {
	private Context context;
	private String[] months;

	public LeftMonthAdapter(Context context) {
		this.context = context;
		months = context.getResources().getStringArray(R.array.yearOfMonth);
	}

	@Override
	public int getCount() {
		return months.length;
	}

	@Override
	public String getItem(int position) {
		return months[position];
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@SuppressLint("ViewHolder")
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = View.inflate(context, R.layout.monthstatis_item2, null);
		TextView tv_month = (TextView) view.findViewById(R.id.tv_month);
		tv_month.setText(getItem(position));
		if (position == getCount()-1) {
			view.findViewById(R.id.view_line).setVisibility(View.GONE);
		}
		return view;
	}
}
